import {TOP_LIST} from '../api'
export default (state,action)=>{
  state = state || {list:[]};
  switch(action.type){
    case 'INIT':
      return {...state,list:action.list};
    default:
      return state;
  }
}
export const getRank = () => (dispatch)=> {
  fetch(TOP_LIST).then(data=>data.json()).then(res=>{
    setTimeout(()=>{
      dispatch({type:'INIT',list:res.data})
    },200)
  })
}